package com.school.system;

public class Teacher {
    // 教师属性
    private String teacherId;   // 教师编号
    private String teacherName; // 教师姓名
    private String gender;      // 教师性别
    private Course taughtCourse;// 所授课程（关联Course类）

    // 构造方法：初始化教师基本信息
    public Teacher(String teacherId, String teacherName, String gender) {
        this.teacherId = teacherId;
        this.teacherName = teacherName;
        this.gender = gender;
    }

    // 教师开课方法：为教师分配所授课程
    public void openCourse(Course course) {
        this.taughtCourse = course;
        System.out.println("教师[" + teacherName + "]成功开设课程[" + course.getCourseName() + "]");
    }

    // Getter方法：供外部获取私有属性
    public String getTeacherId() { return teacherId; }
    public String getTeacherName() { return teacherName; }
    public String getGender() { return gender; }
    public Course getTaughtCourse() { return taughtCourse; }
}


